Fix string injection vulnerability in FilterExpressionConverter imple… #4658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes several
AbstractFilterExpressionConverterimplementations that handledStringvalues incorrectly by directly embedding them into the filter expression without proper escaping.Previously, many converters contained code like:
This approach is unsafe because it assumes that
sdoes not contain special characters such as quotes (") or backslashes (\), which can lead to malformed expressions or potential injection issues.Changes Introduced
Stringvalues in all affected converters.Motivation
This change prevents potential filter expression injection issues and ensures consistent and safe encoding of string literals across all filter expression converters.
Testing
",\, unicode sequences, etc.).Related Issue
Fixes #4545
Checklist
Example Before / After
"abc"valueText:"abc"valueText:"abc""a\"b"valueText:"a"b"valueText:"a\\\"b""C:\\path"valueText:"C:\path"valueText:"C:\\\\path"